package ooday03;

public class ReArrayDemo {
    public static void main(String[] args) {
        Dog[] dogs = new Dog[3];
        Fish[] fish = new Fish[2];
        Chick[] chicks = new Chick[3];

        dogs[0] = new Dog("小黑",1,"黑");
        dogs[1] = new Dog("小黄",2,"黄");
        dogs[2] = new Dog("小白",3,"白");

        for (int i = 0; i <dogs.length ; i++) {
            System.out.println(dogs[i].name);
            dogs[i].lookHome();
        }

        fish[0] = new Fish("小金",1,"金");
        fish[1] = new Fish("小粉",2,"粉");
        for (int i = 0; i < fish.length; i++) {
            System.out.println(fish[i].name);
            fish[i].swim();
        }

        chicks[0] = new Chick("小花",1,"花");
        chicks[1] = new Chick("大花",2,"花");
        chicks[2] = new Chick("🐤",1,"黄");
        for (int i = 0; i < chicks.length; i++) {
            System.out.println(chicks[i].name);
            chicks[i].layEggs();
        }
    }
}
